<template lang="en">
    <div>
        榜单
        <div v-for="item in dataList" :key="item.id" class="list">
            <div>
                <img :src="item.coverImgUrl" alt="">{{item.name}}
            </div>
            
            
        </div>
    </div>
</template>
<script>
import axios from 'axios';
export default {
    data() {
        return {
                        dataList: [],
        }
    },
    mounted() {
        this.ajaxTopic();
    },
    methods: {
        ajaxTopic() {
    //   console.log('submit', values);
            let url = `http://121.41.51.182:3000/toplist`;
            return axios({
                method: "get",
                timeout: 1000 * 30,
                url: url,
                dataType: "json",
            })
                .then((res) => {
                    this.dataList = res.data.list;
                    console.log(this.dataList);
                    this.$toast.success('成功');
                    return res;
                })
                .catch(function (error) {
                    alert("获取失败，请稍后重试");
                    console.log(error);
                });
    },
    },
}
</script>
<style scoped>
.list {
  display: block;
  height: 50px;
  padding: 10px 5px;
}
img {
    width: 55px;
}
</style>
